treeview: Make expanders work again
authorMatthias Clasen <mclasen@redhat.com>
Sun, 7 Apr 2019 12:16:20 +0000 (12:16 +0000)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 7 Apr 2019 12:16:20 +0000 (12:16 +0000)
These were broken by the crossing event unification.
We are now generating some more crossing events, and
the treeview was not looking closely enough at the
ones it gets.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1814
gtk/gtktreeview.c

index a1eda1d11b04b7bd7d5a9985424c6cbb640cb928..19c085a1c1cb2db3de456760aee9bdc96b0ed016 100644 (file)
@@ -5472,15 +5472,21 @@ gtk_tree_view_motion_controller_leave (GtkEventControllerMotion *controller,
                                        GdkNotifyType             detail,
                                        GtkTreeView              *tree_view)
 {
+  gboolean is_focus, contains_focus;
+
   if (tree_view->priv->prelight_node)
     gtk_widget_queue_draw (GTK_WIDGET (tree_view));
 
   tree_view->priv->event_last_x = -10000;
   tree_view->priv->event_last_y = -10000;
 
-  prelight_or_select (tree_view,
-                     NULL, NULL,
-                     -1000, -1000); /* coords not possibly over an arrow */
+  g_object_get (controller,
+                "is-pointer-focus", &is_focus,
+                "contains-pointer-focus", &contains_focus,
+                NULL);
+
+  if (!is_focus && !contains_focus)
+    prelight_or_select (tree_view, NULL, NULL, -1000, -1000); /* not possibly over an arrow */
 }
 
 static void
@@ -5489,10 +5495,18 @@ gtk_tree_view_key_controller_focus_out (GtkEventControllerKey *key,
                                         GdkNotifyType          detail,
                                         GtkTreeView           *tree_view)
 {
+  gboolean is_focus, contains_focus;
+
   gtk_widget_queue_draw (GTK_WIDGET (tree_view));
 
+  g_object_get (key,
+                "is-focus", &is_focus,
+                "contains-focus", &contains_focus,
+                NULL);
+
   /* destroy interactive search dialog */
-  if (tree_view->priv->search_window)
+  if (tree_view->priv->search_window &&
+      !is_focus && !contains_focus)
     gtk_tree_view_search_window_hide (tree_view->priv->search_window, tree_view,
                                       gtk_get_current_event_device ());
 }